/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.diagram.activity.figure;

import org.eclipse.draw2d.Ellipse;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Rectangle;

/**
 * FlowFinalNodeFigure.
 * 
 * @author Sylvain Robert
 * @since 10 apr. 07
 */
public class FlowFinalNodeFigure extends Ellipse{
 
	/**
     * Default Constructor.
     */
    public FlowFinalNodeFigure(){
        super();
        setLineWidth(2);
    }
    
    

    /*(non-javadoc)
     * @see org.eclipse.draw2d.Shape#fillShape(org.eclipse.draw2d.Graphics)
     */
	@Override
    protected void fillShape(Graphics graphics) {
    	final double sinpi4 = 0.7 ;
		graphics.pushState();
        Rectangle f = Rectangle.SINGLETON;
        Rectangle r = getBounds();
        f.x = r.x + (int) ((1-sinpi4) * (r.width / 2));
        f.y = r.y + (int) ((1-sinpi4) * (r.height/2));
        f.width = (int) (sinpi4 * r.width) ;
        f.height = (int) (sinpi4 * r.height);
        graphics.setLineWidth(2) ;
        graphics.drawLine(f.getTopLeft(), f.getBottomRight());
        graphics.drawLine(f.getTopRight(), f.getBottomLeft());
        graphics.popState();
    }
    
    
    
}